package com.yt.dor.service;

import com.yt.dor.models.vo.StatisticsVO;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.BeanUtils;
import javax.annotation.Resource;
import com.yt.dor.common.config.YmlConfig;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import com.yt.dor.mapper.DormAllocationMapper;
import com.yt.dor.models.service.IDormAllocationService;
import com.yt.dor.models.bo.DormAllocationSaveBO;
import com.yt.dor.models.dto.DormAllocationDTO;

/**
 * 宿舍分配表详情控制器
 *
 * @author thekai
 * @Date 2025-10-21 14:10:31
 */
@DubboService
public class DormAllocationServiceImpl extends ServiceImpl<DormAllocationMapper, DormAllocationDTO> implements IDormAllocationService {

    @Resource
    private YmlConfig ymlConfig;
    @Resource
    private DormAllocationMapper dormAllocationMapper;

    @Override
    public boolean add(DormAllocationSaveBO saveBO) {
        DormAllocationDTO dto = new DormAllocationDTO();
        BeanUtils.copyProperties(saveBO, dto);
        Long id = ymlConfig.getPkId();
        dto.setId(id);
        return this.insert(dto);
    }

    @Override
    public StatisticsVO queryStatis() {
        StatisticsVO statisticsVO = dormAllocationMapper.queryStatis();
        return statisticsVO;
    }
}
